From: Stijn Tintel Date: Thu, 25 Nov 2021 04:01:51 +0000 (+0200) Subject: fw4.uc: introduce DEPRECATED flag X-Git-Url: http://git.openwrt.org/%22http:/oss.oetiker.ch/rrdtool//%22/%22http:/oss.oetiker.ch/rrdtool/%22?a=commitdiff_plain;h=334a127df426286101f90c4f9ec79f8b64d59f14;p=project%2Ffirewall4.git fw4.uc: introduce DEPRECATED flag When a section contains unknown options, the parse_options function will return false, and based on that the entire section might be skipped. For example, rules containing a _name option will be skipped. As this option used to be added by LuCI in the past, we should not skip those rules, as it might break existing configs for many users. Add a new DEPRECATED flag to handle such options. Suggested-by: Jo-Philipp Wich Signed-off-by: Stijn Tintel Reviewed-by: Jo-Philipp Wich --- diff --git a/root/usr/share/ucode/fw4.uc b/root/usr/share/ucode/fw4.uc index 8057fac..df5ab87 100644 --- a/root/usr/share/ucode/fw4.uc +++ b/root/usr/share/ucode/fw4.uc @@ -11,6 +11,7 @@ let FLATTEN_LIST = 0x02; let NO_INVERT = 0x04; let UNSUPPORTED = 0x08; let REQUIRED = 0x10; +let DEPRECATED = 0x20; let ipv4_icmptypes = { "any": [ 0xFF, 0, 0xFF ], @@ -622,7 +623,9 @@ return { } if (res != null) { - if (flags & UNSUPPORTED) + if (flags & DEPRECATED) + this.warn_section(s, "option '" + key + "' is deprecated by fw4"); + else if (flags & UNSUPPORTED) this.warn_section(s, "option '" + key + "' is not supported by fw4"); else rv[key] = res;